package cn.hzc.fortess.system.dao;

import cn.hzc.fortess.system.entity.Role;
import cn.hzc.fortess.system.search.RoleSearch;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoleDao {

    int delete(Integer id);

    int insert(Role record);

    int deleteRelationByRole(Integer id);

    Role findById(Integer id);

    int update(Role record);

    List<Role> findByProjectId(Integer projectId);

    List<Role> findByUserId(Integer userId);

    List<Role> page(RoleSearch search);

    long count(RoleSearch search);

    int clearRoleResourceAuth(Integer id);

//    int clearRoleUser(Integer id);

    int clearRoleUser0(@Param("id")Integer id,@Param("lesseeId") Integer lesseeId);


    int saveRoleUser(@Param("roleId") Integer roleId, @Param("userId")Integer userId);


    int saveRoleResourceAuth(@Param("roleId") Integer roleId, @Param("resourceId")Integer resourceId);

    int clearRoleDataResourceAuth(Integer id);

    int saveRoleDataResourceAuth(@Param("roleId") Integer roleId,
                                 @Param("resourceId")Integer resourceId,
                                 @Param("resourceAttrId")Integer resourceAttrId,
                                 @Param("attrAuth")String attrAuth,
                                 @Param("priority")Integer priority
                                 );


}